#ifndef _LINK_H_
#define _LINK_H_

#include<iostream>


using namespace std;

class Link
{
 private:
  Link* pre;
  Link* succ;
  string val;

 public:
 Link(const string& str,Link* p=nullptr,Link* q=nullptr):
  val{str},pre{p},succ{q}{}
  Link* insert(Link* n);  //insert n before the present object
  Link* add(Link* n);  //add n after the present object
  Link* erase();  //erase the present object and the successor
  Link* find(const string& s);
  Link* move(int n);
  void print()
  {
    cout<<val;
  }
  Link* next() const
  {
    return succ;
  }
  
  Link* previous() const
  {
    return pre;
  }
};

#endif
